{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Omni-test\n",
    "The Omni-test problem is a multi-modal multi-objective optimization problem proposed by Deb in <cite data-cite=\"omni_test\"></cite>. It has two objective\n",
    "functions. Suppose that the dimension of the decision space is $D$, then it has $3^D$ Pareto subsets in the decision\n",
    "space corresponding to the same Pareto front."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2-dimensional case\n",
    "### Pareto front"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from pymoo.problems.multi.omnitest import OmniTest\n",
    "from pymoo.visualization.scatter import Scatter\n",
    "\n",
    "problem = OmniTest(n_var=2)\n",
    "pf = problem.pareto_front(1000)\n",
    "Scatter(title=\"Pareto front\").add(pf).show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Pareto set"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "ps = problem.pareto_set(1000)\n",
    "Scatter(title=\"Pareto set\", labels=[\"$x_1$\", \"$x_2$\"]).add(ps).show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 3-dimensional case\n",
    "### Pareto front"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "problem = OmniTest(n_var=3)\n",
    "pf = problem.pareto_front(3000)\n",
    "Scatter(title=\"Pareto front\").add(pf).show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Pareto set"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "\n",
    "ps = problem.pareto_set(1000)\n",
    "sc = Scatter(title=\"Pareto set\", labels=[\"$x_1$\", \"$x_2$\", \"$x_3$\"])\n",
    "sc.add(ps)\n",
    "sc.do()\n",
    "sc.ax.view_init(elev=20, azim=5)\n",
    "plt.show()"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
